<!DOCTYPE html>
<html>

	<head>
		<meta charset="UTF-8">
		<title>flex盒模型</title>
		<script src="js/angular.js"></script>
		<script src="js/jquery.js"></script>
		<script src="js/bootstrap.js"></script>
		<script src="js/underscore.js"></script>
		<!--从已知数组中删除某一项的js库  Lodash.js同为处理数据的js库-->
		<script src="js/index.js"></script>
		<link rel="stylesheet" href="css/bootstrap.css" />
		<link href="font-awesome-4.7.0/css/font-awesome.min.css" rel="stylesheet" />
		<link rel="stylesheet" href="css/index.css" />
	</head>
	<script>
		var d = [1, 2, 3, 1, 35, 0, 0];
		e = _.without(d, 0, 1);
		console.log(e);
	</script>

	<body ng-app="myApp" ng-controller="ctrl">
		<form action="" method="post" class="form-horizontal" role="form">
			<div class="container">
				<div class="row">
					<div class="col-xs-4" class="app">
						<div class="mobile">
							<dl ng-repeat='c in data.button'>
								<dt>{{c.name}}</dt>
								<dd>
									<a href="#" ng-repeat="v in c.sub_button">{{v.name}}</a>
								</dd>
							</dl>
						</div>
					</div>
					<div class="col-xs-8">
						<div class="panel panel-default">
							<div class="panel-heading">
								<h3>编辑</h3>
							</div>
							<div class="panel-body">
								<!--一级菜单开始-->
								<div class="panel panel-default top-menu" ng-repeat='v in data.button'>
									<i class="fa fa-times-circle top-fa fa-2x" ng-click='removeTopmenu(v)'></i>
									<div class="panel-body">
										<div class="form-group">
											<label for="" class="col-sm-2" control-label>标题</label>
											<div class="col-sm-10">
												<input type="text" class="form-control" ng-model='v.name' />
											</div>
										</div>
										<div class="form-group" ng-if="v.type=='click'&&!v.sub_button.length">
											<label for="" class="col-sm-2" control-label>关键词</label>
											<div class="col-sm-10">
												<input type="text" class="form-control" ng-model='v.key' />
											</div>
										</div>
										<div class="form-group" ng-if="v.type=='view'&&!v.sub_button.length">
											<label for="" class="col-sm-2" control-label>链接</label>
											<div class="col-sm-10">
												<input type="text" class="form-control" ng-model='v.url' />
											</div>
										</div>
										<div class="form-group" ng-if='!v.sub_button.length'>
											<label for="" class="col-sm-2" control-label>类型</label>
											<div class="col-sm-10">
												<label class="radio-inline">
													  <input type="radio" ng-model = "v.type" ng-value="'click'"> 关键词
													</label>
												<label class="radio-inline">
													  <input type="radio" ng-model = "v.type" ng-value="'view'"> 链接
													</label>
											</div>
										</div>
										<!--
		                                	二级菜单开始
		                                -->
										<div class="panel-body" ng-repeat="d in v.sub_button">
											<div class="panel panel-default sub-menu">
												<i class="fa fa-times-circle sub-fa fa-2x" ng-click='removeSubmenu(v,d)'></i>
												<div class="panel-body">

													<div class="form-group">
														<label for="" class="col-sm-2" control-label>标题</label>
														<div class="col-sm-10">
															<input type="text" class="form-control" ng-model='d.name' />
														</div>
													</div>
													<div class="form-group" ng-if='d.type=="view"'>
														<label for="" class="col-sm-2" control-label>链接</label>
														<div class="col-sm-10">
															<input type="text" class="form-control" ng-model='d.url' />
														</div>
													</div>
													<div class="form-group" ng-if='d.type=="click"'>
														<label for="" class="col-sm-2" control-label>关键词</label>
														<div class="col-sm-10">
															<input type="text" class="form-control" ng-model='d.url' />
														</div>
													</div>
													<div class="form-group">
														<label for="" class="col-sm-2" control-label>类型</label>
														<div class="col-sm-10">
															<label class="radio-inline">
													  <input type="radio" ng-model = "d.type" ng-value="'click'"> 关键词
													</label>
															<label class="radio-inline">
													  <input type="radio" ng-model = "d.type" ng-value="'view'"> 链接
													</label>
														</div>
													</div>
												</div>
											</div>

										</div>
										<button type="button" class="btn btn-info" ng-click='addsubMenu(v)'>添加菜单</button>
									</div>

								</div>
								<!--一级菜单结束-->
								<button type="button" class="btn btn-success" ng-click='addTopMenu()'>添加一级菜单</button>
							</div>
						</div>

					</div>
				</div>
			</div>
		</form>
	</body>

</html>
